<template>
  <div class="recommend">
    <Card></Card>
    <ul>
      <li v-for="(item, index) in recommendList" :key="index">
        <h2>
          <img :src="item.imgUrl" alt="" />
        </h2>
        <div>
          <h3>{{ item.name }}</h3>
          <p>{{ item.content }}</p>
          <div class="price">
            <span>¥</span>
            <b>{{ item.price }}</b>
          </div>
        </div>
      </li>
    </ul>
  </div>
</template>

<script>
import Card from "@/components/home/Card.vue";
export default {
  data() {
    return {
      recommendList: [
        {
          id: 1,
          name: "飘",
          content:
            "飘书原版书籍正版原著乱世佳人上下册中文版经典世界名著外国文学作品长篇小说中学生高中生课外阅读必读课外书",
          price: "28",
          imgUrl: "./images/recommend1.jpg",
        },
        {
          id: 2,
          name: "白鹿原",
          content:
            "白鹿原正版无删减完整版陈忠实著原版原本原著未删减版1993版一版一印茅盾文学奖获奖作品1993年现当代经典文学小说书籍作家出版社",
          price: "32",
          imgUrl: "./images/recommend2.jpg",
        },
        {
          id: 3,
          name: "悲惨世界",
          content:
            "悲惨世界书正版雨果原著全译本上下2册原版中文版世界十大经典文学名著长篇小说外国文学畅销书雨果的书籍悲催",
          price: "46",
          imgUrl: "./images/recommend3.jpg",
        },
      ],
    };
  },
  components: {
    Card,
  },
};
</script>

<style scoped>
.recommend ul li {
  position: relative;
}
.recommend ul li h2 {
  text-align: left;
}
.recommend ul li img {
  width: 4.3rem;
  height: 3.8rem;
  border-radius: 20px;
}
.recommend ul li > div {
  position: absolute;
  right: 0;
  top: 0;
  width: 50%;
}
.recommend ul li > div {
  position: absolute;
  right: 0;
  top: 0;
  display: flex;
  flex-direction: column;
  padding: 0.533333rem;
}
.recommend ul li > div h3 {
  font-size: 16px;
}
.recommend ul li > div p {
  font-size: 10px;
  word-break: break-all;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  /* text-overflow: ellipsis;
  white-space: nowrap; */
}
.price {
  margin-top: 0.666666rem;
  text-align: right;
  color: red;
}
.price span {
  font-size: 0.373333rem;
}
</style>
